<div class="main-content grid_5 alpha">
  <header>
    <div class="action-buttons clearfix fr">
        <a href="#" class="has-popupballoon button button-gray"><span class="add"></span>Upload Journal</a>
        <div class="popupballoon top">
						<form id="form" class="form" novalidate="true" action="<?php echo bu('admin/journals/create'); ?>" method="POST" enctype="multipart/form-data">
								<h3>Upload New Journal</h3>
								<h4>Title *<h4>
								<input type="text" name="Journals[title]" required="required" style="width:150px;" />
                <br /><br /><br />

                <h4>For *</h4>
                <select name='Journals[member_id]' style='width:150px;'>
                  <?php foreach($members as $member){ ?>
                    <option value='<?php echo $member->id; ?>'><?php echo $member->name; ?></option>
                  <?php } ?>
                </select>

								<br /><br /><br />
								<h4>File *</h4>
								<?php echo CHtml::activeFileField($model, 'upload', array('required' => 'required', 'style' => 'width:150px;')); ?>

								<button class="button button-orange" type="submit">Upload</button>
								<button class="button button-gray close" type="reset">Cancel</button>
						</form>
        </div>
    </div>
    <h2>Journal</h2>
  </header>

  <section>
    <?php echo $this->renderPartial('/partials/_notifications'); ?>

		<table class="datatable paginate sortable full">
			<thead>
				<tr>
					<th>Title</th>
					<th>Created At</th>
					<th style="width:70px"></th>
				</tr>
			</thead>
			<tbody>
				<?php foreach ($journals as $journal){ ?>
				<tr>
					<td align="center"><a href="<?php echo bu('admin/journals/download'); ?>?id=<?php echo $journal->id; ?>"><?php echo $journal->title; ?></a></td>
					<td align="center"><?php echo Helpers::customDate($journal->created_at); ?></td>
					<td>
						<ul class="action-buttons">
							<li><a href="<?php echo bu('admin/journals/delete'); ?>?id=<?php echo $journal->id; ?>" method="POST" class="button button-gray no-text"><span class="bin"></span>Delete</a></li>
						</ul>
					</td>
				</tr>
				<?php } ?>
			</tbody>
		</table>
  </section>
</div>